{template 'common/header'}
<title>培训课程报名确认</title>
<style type="text/css">
    *{margin:auto;}
    body {margin:0; font-family:'微软雅黑'; background:url('../addons/ewei_shop/template/mobile/default/static/images/jiameng/beijing2.png') no-repeat 0 0;background-size:100% 600px;}
    a:link,a:visited,a:active{color:#fff;text-decoration:none;}
    a{ text-decoration: none;}
    .content{width:80%;height:450px;margin-top:60px;float:left;margin-left:10%;}
    .content .title{width:100%;height:40px;color:#fff;font-size:20px;text-align:center;line-height:40px;}
    .content .detail{width:90%;height:60px;text-align:right;margin-top:30px;color:#CFCFCE;font-size:12px;}
    .content .name{width:90%;height:20px;color:#fff;font-size:14px;}
    .content .name span{font-size:12px;}
    .content .neirong{width:90%;height:40px;border:1px solid #ADB3BF;margin-bottom:10px;}
    .neirong input {float:left; height:40px; width:95%; padding:0px; margin:0px; border:0px; outline:none; font-size:16px; color:#fff;padding-left:5px;background:none;}
    .submit{width:40%;height:40px;background:#049F58;color:#fff;font-size:16px;font-weight:bold;float:left;margin-left:30%;text-align:center;line-height:40px;}
</style>
<div class="content">
    <div class="title">培训课程报名确认</div>
    <div class="detail">{$lesson['title']}<br/>地址：{$lesson['address']}<br/>时间：{$lesson['starttime']}</div>
    <div class="name">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名/ <span>NAME</span></div>
    <div class="neirong"><input type="text" id="name" value="" /></div>
    <div class="name">门店名称/ <span>STORE NAME</span></div>
    <div class="neirong"><input type="text" id="shop_name" value="" /></div>
    <div class="name">门店地址/ <span>ADDRESS</span></div>
    <div class="neirong"><input type="text" id="shop_address" value="" /></div>
    <div class="name">联系电话/ <span>CONTACT NUMBER</span></div>
    <div class="neirong"><input type="text" id="mobile" value="" /></div>
</div>
<div class="submit" id='submit'>确认报名</div>
<script language="javascript">
    require(['tpl', 'core'], function(tpl, core) {
        $('#submit').click(function() {
            if ($(this).attr('saving') == '1') {
                return;
            }
            $(this).html('正在处理...').attr('saving', 1);
            if ($('#name').isEmpty()) {
                core.tip.show('请输入姓名!');
                 $("#submit").html('确认报名').removeAttr('saving');
                return;
            }
            if ($('#shop_name').isEmpty()) {
                core.tip.show('请输入门店名称!');
                 $("#submit").html('确认报名').removeAttr('saving');
                return;
            }
            if ($('#shop_address').isEmpty()) {
                core.tip.show('请输入门店地址!');
                 $("#submit").html('确认报名').removeAttr('saving');
                return;
            }
            if ($('#mobile').isEmpty()) {
                core.tip.show('请输入联系电话!');
                 $("#submit").html('确认报名').removeAttr('saving');
                return;
            }
            var data = {
                name: $('#name').val(),
                shop_name: $('#shop_name').val(),
                shop_address: $('#shop_address').val(),
                mobile: $('#mobile').val()
            }
            core.json('franchise/center', {
                op: 'class_submit',
                id: "{$_GPC['id']}",
                data: data
            }, function(postjson) {
                if (postjson.status == 1) {
                    alert("提交成功！");
                    $("#submit").html('确认报名').removeAttr('saving');
                }
                if (postjson.status == -1) {
                    core.tip.show('您已提交过，不能重复提交！');
                    $("#submit").html('确认报名').removeAttr('saving');
                }
                if (postjson.status == 0) {
                    core.tip.show('操作失败');
                    $("#submit").html('确认报名').removeAttr('saving');
                }
            }, true, true);
        });
    });
</script>
{template 'common/footer'}